def func(num, a, b, c):
    global count
    if num == 1:
        count += 1
        print(f"[STEP{count: 4}] {a}->{c}")
    else:
        func(num - 1, a, c, b)
        count += 1
        print(f"[STEP{count: 4}] {a}->{c}")
        func(num - 1, b, a, c)


if __name__ == "__main__":
    count = 0
    num = int(input(""))
    func(num, "A", "B", "C")
